package cn.zust.ly.EyExample.Ez51;

import java.util.Scanner;

/**
 * Created by liy on 2016/11/25.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n == 1) System.out.println("2");
        else {
            long s = 2,x = 3;
            for (int i = 1;i < n;) {
                if (isPrime(x)) {
                    s *= x;i++;
                    s %= 50000;
                    System.out.println(x);
                }
                x += 2;
            }
            System.out.println(s%50000);
        }

    }

    static boolean isPrime (long x) {
        if (x % 2 == 0) return false;
        for (int i = 3; i*i <= x; i += 2) {
            if (x % i == 0) return false;
        }

        return true;
    }
}
